package com.it.sun.redismq.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.RedisSerializer;

/**
 * @ClassName com.it.sun.redismq.config.RedisConfiguration
 * @Author sun
 * @Date 2021/1/28 10:57
 * @Version V1.0
 * Description  <redis配置类>
 * Copyright (C) XXX  since 2021/1/28
 */
@Configuration
public class RedisConfiguration {

    @Bean
    public RedisTemplate redisTemplate(RedisTemplate redisTemplate) {
        RedisSerializer<String> redisSerializer = RedisSerializer.string ();
        redisTemplate.setValueSerializer (redisSerializer);
        redisTemplate.setHashKeySerializer (redisSerializer);
        redisTemplate.setDefaultSerializer (redisSerializer);
        redisTemplate.setStringSerializer (redisSerializer);
        return redisTemplate;
    }

}



